package com.wakala.employment.fragment.other;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.wakala.employment.R;
import com.wakala.employment.core.BaseFragment;
import com.wakala.employment.databinding.FragmentAboutBinding;
import com.wakala.employment.databinding.FragmentAccountManageBinding;
import com.wakala.employment.fragment.profile.ModifyPhoneFragment;
import com.xuexiang.xpage.annotation.Page;
import com.xuexiang.xpage.enums.CoreAnim;
import com.xuexiang.xui.widget.actionbar.TitleBar;
import com.xuexiang.xui.widget.textview.supertextview.SuperTextView;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link AccountManageFragment#} factory method to
 * create an instance of this fragment.
 */
@Page(anim = CoreAnim.none)
public class AccountManageFragment extends BaseFragment<FragmentAccountManageBinding> implements SuperTextView.OnSuperTextViewClickListener {


    @NonNull
    @Override
    protected FragmentAccountManageBinding viewBindingInflate(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, boolean attachToRoot) {
        return FragmentAccountManageBinding.inflate(inflater, container, attachToRoot);
    }

    @Override
    protected TitleBar initTitle() {
        return super.initTitle().setTitle("账号管理");
    }

    @Override
    protected void initListeners() {
        super.initListeners();
        binding.menuCloseAccount.setOnSuperTextViewClickListener(this);
        binding.menuChangePhone.setOnSuperTextViewClickListener(this);
    }

    @Override
    protected void initViews() {

    }

    @Override
    public void onClick(SuperTextView superTextView) {
        int id = superTextView.getId();
        if(id==R.id.menu_change_phone){
            openNewPage(ModifyPhoneFragment.class);
        } else if (id ==R.id.menu_close_account) {
            openNewPage(CloseAccountFragment.class);
        }
    }
}